package com.bestcem.xm.om.dao.impl;

import com.bestcem.xm.om.dao.UserModulePackDao;
import com.bestcem.xm.om.dao.mapper.UserModulepackMapper;
import com.bestcem.xm.om.entity.UserModulepack;
import com.bestcem.xm.om.enums.PackageCategoryEnum;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * 套餐dao
 *
 * @author zhangfeng <feng.zhang@idiaoyan.com>
 * @version v1.0
 * @date 2021/7/16 15:49
 */
@Repository
public class UserModulePackDaoImpl implements UserModulePackDao {
    @Resource
    private UserModulepackMapper userModulepackMapper;

    @Override
    public UserModulepack queryById(String id) {
        return userModulepackMapper.queryById(id);
    }

    @Override
    public List<UserModulepack> queryAllByLimit(UserModulepack userModulepack) {
        return userModulepackMapper.queryAllByLimit(userModulepack);
    }

    @Override
    public long count(UserModulepack userModulepack) {
        return userModulepackMapper.count(userModulepack);
    }

    @Override
    public int insert(UserModulepack userModulepack) {
        return userModulepackMapper.insert(userModulepack);
    }

    @Override
    public int insertBatch(List<UserModulepack> entities) {
        return userModulepackMapper.insertBatch(entities);
    }

    @Override
    public int insertOrUpdateBatch(List<UserModulepack> entities) {
        return userModulepackMapper.insertOrUpdateBatch(entities);
    }

    @Override
    public int update(UserModulepack userModulepack) {
        return userModulepackMapper.update(userModulepack);
    }

    @Override
    public int deleteById(String id) {
        return userModulepackMapper.deleteById(id);
    }

    @Override
    public List<UserModulepack> listByPackId(String packId) {
        return userModulepackMapper.listByPackId(packId);
    }

    @Override
    public void deleteByPackId(String packId) {
        userModulepackMapper.deleteByPackId(packId);
    }

    @Override
    public List<UserModulepack> listByPackIdAndCategory(String packId, PackageCategoryEnum category) {
        return userModulepackMapper.listByPackIdAndCategory(packId, category.getIndex());
    }
}

